package Test;
public class Computer {
    //普通成员变量
    protected String name;
    public int edition;
    public String color;
    //静态成员变量
    static String all_name;
    //实例代码块
    {
        System.out.println("父类 实例代码块执行");
    }
    //静态代码块
    static{
        Computer.all_name = "计算机";
        System.out.println("父类 静态代码块执行");
    }
    public Computer(){
        this("xiaomi",15,"grey");
        System.out.println("父类 构造方法执行");
    }
    //构造方法
    public Computer(String name,int edititon,String color){
        this.name = name;
        this.edition = edititon;
        this.color = color;
    }

    @Override
    public String toString() {
        return "Computer{" +
                "name='" + name + '\'' +
                ", edition=" + edition +
                ", color='" + color + '\'' +
                '}';
    }

    //成员方法
    public void open() {
        System.out.println(name + "开启电脑");
    }
    public void close() {
        System.out.println(name + "关闭电脑");
    }
}


